Skip to content

feat(cli): check managed global outdated packages#1659

Open
liangmiQwQ wants to merge 21 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix-1656-outdated-parallel-npm-view
Open

feat(cli): check managed global outdated packages#1659
liangmiQwQ wants to merge 21 commits into
voidzero-dev:mainfrom
liangmiQwQ:fix-1656-outdated-parallel-npm-view

Conversation

@liangmiQwQ
Copy link
Copy Markdown
Contributor

@liangmiQwQ liangmiQwQ commented May 21, 2026

Implemented the outdated part of #1656 by routing vp outdated -g through Vite+'s managed global package metadata instead of delegating to the underlying npm outdated -g store.

This PR includes a refactor for global package commands. This is intentional, taking into account that commands like outdated and install have many shared utils, putting all of them inside env module will reduce maintainability.

Also modify vp update -g to reuse the utilities added in this PR.

🤖 Generated with Codex

@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit f5c3a8c
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a12ffef14bf9f0008f975f5

@liangmiQwQ liangmiQwQ changed the title fix(cli): check managed global outdated packages feat(cli): check managed global outdated packages May 21, 2026
@liangmiQwQ liangmiQwQ marked this pull request as ready for review May 22, 2026 13:16
@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

…arallel-npm-view

# Conflicts:
#	crates/vite_global_cli/src/shim/dispatch.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f78fcfb73e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_pm_cli/src/handlers.rs
Comment thread crates/vite_global_cli/src/commands/global/outdated.rs Outdated
@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f0959a422

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_global_cli/src/commands/global/outdated.rs
@liangmiQwQ liangmiQwQ marked this pull request as draft May 22, 2026 14:36
@liangmiQwQ liangmiQwQ marked this pull request as ready for review May 22, 2026 15:06
@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 48d693cdad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_global_cli/src/commands/global/outdated.rs
@liangmiQwQ liangmiQwQ marked this pull request as draft May 23, 2026 06:22
@liangmiQwQ liangmiQwQ marked this pull request as ready for review May 23, 2026 07:19
@fengmk2
Copy link
Copy Markdown
Member

fengmk2 commented May 24, 2026

@codex review

@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests labels May 24, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6480105d81

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/vite_global_cli/src/commands/global/outdated.rs Outdated
Comment thread crates/vite_global_cli/src/cli.rs Outdated
Comment thread crates/vite_global_cli/src/commands/global/outdated.rs
package.name.clone(),
OutdatedPackageJson {
current: package.current.clone(),
wanted: package.latest.clone(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep npm-compatible wanted value in global JSON output

The JSON formatter sets wanted to latest, but for global/out-of-package specs npm’s outdated schema reports wanted as the currently installed version. This makes vp outdated -g --format json semantically incompatible with npm consumers and can cause scripts to misinterpret upgrade intent.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@liangmiQwQ liangmiQwQ May 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little bit strange, I tested locally and it seems npm always prints latest as wanted, while the document says current should be wanted

% npm outdated -g
Package  Current   Wanted   Latest  Location          Depended by
npm      11.13.0  11.15.0  11.15.0  node_modules/npm  global
vue        2.0.0   3.5.34   3.5.34  node_modules/vue  global

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well as JSON

{
  "npm": {
    "current": "11.6.2",
    "wanted": "11.15.0",
    "latest": "11.15.0",
    "dependent": "global",
    "location": "/Users/liangmi/.vite-plus/js_runtime/node/25.0.0/lib/node_modules/npm"
  }
}

Copy link
Copy Markdown
Contributor Author

@liangmiQwQ liangmiQwQ May 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a problem on npm side. npm/cli#3612

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be resolved if npm/cli#9401 is in the proper way.

Comment thread crates/vite_global_cli/src/cli.rs
@liangmiQwQ liangmiQwQ marked this pull request as draft May 24, 2026 13:17
Copy link
Copy Markdown
Member

fengmk2 commented May 24, 2026

Manual validation found one regression in the all-globals outdated path.

Repro on Windows from this PR head 6480105d81835d293bcdd7d3f941dea39e1d038f, using an isolated VP_HOME:

vp install -g testnpm2@1.0.0
vp pm list -g --json
vp outdated -g --format json
vp outdated testnpm2 -g --format json

Observed:

  • vp pm list -g --json shows testnpm2@1.0.0 installed.
  • vp outdated -g --format json prints {} and exits 0.
  • vp outdated testnpm2 -g --format json correctly reports testnpm2 as outdated (1.0.0 -> 1.0.1) and exits 1.

Expected: vp outdated -g --format json should check all managed globals and report the same outdated package.

Likely cause: crates/vite_global_cli/src/commands/global/outdated.rs calls get_outdated_packages(Some(packages), concurrency) unconditionally in execute(). For an empty package slice, that means “check zero explicit packages” instead of “check all installed globals”. The update path already uses the right distinction via packages.as_deref() in managed_update().

@liangmiQwQ
Copy link
Copy Markdown
Contributor Author

This problem is caused by a wrong refactor, let me fix it, and thanks for testing.

@liangmiQwQ liangmiQwQ marked this pull request as ready for review May 24, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants